package org.example.stockservice.controller;

import lombok.RequiredArgsConstructor;
import org.example.stockservice.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/stock")
public class StockController {
    @Autowired
    private StockService stockService;

    @PostMapping("/deduct")
    public String deduct(@RequestParam String commodityCode,
                         @RequestParam int count){
        stockService.deduct(commodityCode, count);
        return "deduct ok";
    }
}